package com.ai.platform.system.web;

import com.ai.platform.core.annotation.AIController;
import com.ai.platform.core.annotation.RestInvokeService;
import com.ai.platform.core.controller.BaseController;
import com.ai.platform.model.dto.Output;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

/**
 * @Auther: yeyingsheng
 * @Date: 2018/5/28 20:11
 * @Description:角色管理
 */
@AIController
@RequestMapping("/system/role")
public class RoleController extends BaseController{

    private final Logger logger = LoggerFactory.getLogger(RoleController.class);

    /**
     * 角色管理
     * @return
     */
    @GetMapping(value = "/role")
    @RequiresPermissions("role::role")
    public String toRole(){
        return "system/role/role";
    }

    /**
     * 角色管理[列表] 分页查询角色
     * @return
     */
    @RequestMapping(value = "/roleList")
    @RequiresPermissions("role::list")
    @RestInvokeService(serviceName = "sysRoleServiceImpl",method = "listRole")
    public Output listRole(){
        return super.getOutput();
    }


    /**
     * 角色管理[列表] 查询所有角色
     * @return
     */
    @RequestMapping(value = "/roleListAll")
    @RequiresPermissions("role::list")
    @RestInvokeService(serviceName = "sysRoleServiceImpl",method = "listRoleAll")
    public Output listRoleAll(){
        return super.getOutput();
    }
    /**
     * 角色管理[保存]
     * @return
     */
    @PostMapping(value = "/saveRole")
    @RequiresPermissions("role::save")
    @RestInvokeService(serviceName = "sysRoleServiceImpl",method = "saveRole")
    public Output saveRole(){
        return super.getOutput();
    }

    /**
     * 角色管理[修改]
     * @return
     */
    @PostMapping(value = "/updateRole")
    @RequiresPermissions("role::update")
    @RestInvokeService(serviceName = "sysRoleServiceImpl",method = "updateRole")
    public Output updateRole(){
        return super.getOutput();
    }

    /**
     * 角色管理[删除]
     * @return
     */
    @PostMapping(value = "/deleteRole")
    @RequiresPermissions("role::delete")
    @RestInvokeService(serviceName = "sysRoleServiceImpl",method = "deleteRole")
    public Output deleteRole(){
        return super.getOutput();
    }

}
